package config

import (
	"fmt"
	"github.com/aliyun/aliyun-oss-go-sdk/oss"
)

var Endpoint = "oss-cn-beijing.aliyuncs.com"
var AccessKeyId = "LTAI5tSQ7bsjJwVSvjCwpQAz"
var AccessKeySecret = "mKV6sT7XvW28xNLkBtDZFClcGzIW3M"
var BucketName = "roselove"

func UploadToOSS(objectName, localFileName string) error {

	client, err := oss.New(Endpoint, AccessKeyId, AccessKeySecret)
	if err != nil {
		return err
	}

	bucket, err := client.Bucket(BucketName)
	if err != nil {
		return err
	}
	fmt.Println(objectName, localFileName)
	return bucket.PutObjectFromFile(objectName, localFileName)
}
